package test00.test06;

import test07.t04.Studunt;

import java.util.Optional;

/**
 * @Author lzp
 * @Date 2024-04-12
 */
public class Test03 {
    public static void main(String[] args) {

        Studunt studunt = new Studunt("Zs",18);
        Studunt stu2 = new Studunt(null,18);

//        Optional<String> username = Optional.of(Optional
//                .ofNullable(studunt)
//                .map((stu) -> stu.getName()).map((name) -> name.toLowerCase()).orElse("匿名"));
        String s = Optional.of(studunt)
                .map(Studunt::getName).map(String::toLowerCase).orElse("匿名");
    }
}
